/*
 * Copyright (c) 2020, 2023, 3044483124@qq.com All rights reserved.
 *
 */

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * <p>Project: jdbc - JDBCExample
 * <p>Powered by jiangbo On 2023-02-13
 * 14:25:14
 * <p>Created by IntelliJ IDEA
 *
 * @author jiangbo [3044483124@qq.com]
 * @version 1.0
 * @since 8/17
 */
public class JDBCExample {
    public static void main(String[] args) {
        Connection connection = null;
        try {
            // 加载 JDBC 驱动
            Class.forName("com.mysql.jdbc.Driver");

            // 创建连接
            connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/zhao", "root", "123456");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            try {
                if (connection != null) {
                    connection.close();
                }
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
}


